repo/commit: Dedup metadata writing API implementations
authorColin Walters <walters@verbum.org>
Tue, 23 May 2017 18:49:17 +0000 (14:49 -0400)
committerAtomic Bot <atomic-devel@projectatomic.io>
Thu, 1 Jun 2017 18:43:38 +0000 (18:43 +0000)
commit22b1234f52895f31b59f6b8b31659b7ee7879eed
tree5081c1319e328c61f57be93536b70ffeb52d7355
parent1eff3e83436b6129c0dc350dbbda52ba330e3834
repo/commit: Dedup metadata writing API implementations

First, the streaming metadata API is pretty dumb, since metadata
should be small.  Really we should have supported a `GBytes`
version.  Currently, this API *is* used when we do local pulls,
so this commit has test coverage.  However, I plan to change
the object import to avoid using this.  But that's fine, since
I can't think of why someone would use this API.

Next, the only difference between `ostree_repo_write_metadata()` and
`ostree_repo_write_metadata_trusted()` is whether or not we pass
an output checksum; so just dedup the implementations.

Also while I'm here break out the input length validation and do
it early in the streaming case.

Closes: #881
Approved by: jlebon
src/libostree/ostree-repo-commit.c